package com.cyss.greenball.world;

import org.jbox2d.collision.CircleDef;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.Body;
import org.jbox2d.dynamics.BodyDef;

import com.cyss.greenball.util.SystemUtil;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

public class Hole extends ElementObject {

	public static final int TRAP = 0;
	public static final int DESTINY = 1;
	private int type;
	private Body body;
	public float x, y, r;

	public Hole(BallWorld world, float x, float y, float r, int type) {
		super(world);
		this.x = x;
		this.y = y;
		this.r = r;
		this.type = type;
		super.paint.setStyle(Paint.Style.STROKE);
		switch (type) {
		case TRAP:
			super.paint.setColor(Color.BLACK);
			break;

		case DESTINY:
			super.paint.setColor(Color.BLUE);
			break;

		default:
			break;
		}
		world.addHoleElement(this);
		instance();
	}

	@Override
	public void instance() {
		// CircleDef shape = new CircleDef();
		// shape.friction = 0.2f;
		// shape.radius = r / 1.5f / SystemUtil.RATE;
		//
		// BodyDef bodyDef = new BodyDef();
		// bodyDef.position.set(x / SystemUtil.RATE, y / SystemUtil.RATE);
		// body = super.world.createBody(bodyDef);
		// body.createShape(shape);
		// body.setMassFromShapes();
	}

	@Override
	public void onDraw(Canvas canvas) {
		canvas.drawCircle(x, y, r, super.paint);
	}

	public int getHoleType() {
		return this.type;
	}
	
	

	// public Body getHoleBody(){
	// return body;
	// }

}
